package top.kaoshanji.p2ch17a;

import top.kaoshanji.y1constant.FileConstant;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

/**
 * 代码清单-p2ch17a-544页b：将文件中的行以Stream的方式读取
 * author kaoshanji
 * ^_^
 * create time 2025/3/11 17:52
 */
public class ReadLineStream {

    // 将 PathInfo.java 文件复制到该目录下
    static String path = FileConstant.LOCAL_ROOT_PATH.concat("p2ch17a544页b//");

    @SuppressWarnings("resource")
    public static void main(String[] args) throws IOException {

        Files.lines(Paths.get(path.concat("PathInfo.java")))
                .skip(13)
                .findFirst()
                .ifPresent(System.out::println);

    }

}
